home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / HIERSV.PAK / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  127 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. #include "stdafx.h"
  15. #include "hiersvr.h"
  16.  
  17. #include "mainfrm.h"
  18.  
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE THIS_FILE[] = __FILE__;
  22. #endif
  23.  
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CMainFrame
  26.  
  27. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  28.  
  29. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  30.     //{{AFX_MSG_MAP(CMainFrame)
  31.     ON_WM_CREATE()
  32.     //}}AFX_MSG_MAP
  33.     // Global help commands
  34.     ON_COMMAND(ID_HELP_INDEX, CMDIFrameWnd::OnHelpIndex)
  35.     ON_COMMAND(ID_HELP_USING, CMDIFrameWnd::OnHelpUsing)
  36.     ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
  37.     ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpIndex)
  38.     ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
  39. END_MESSAGE_MAP()
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // arrays of IDs used to initialize control bars
  43.  
  44. // toolbar buttons - IDs are command buttons
  45. static UINT BASED_CODE buttons[] =
  46. {
  47.     // same order as in the bitmap 'toolbar.bmp'
  48.     ID_FILE_NEW,
  49.     ID_FILE_OPEN,
  50.     ID_FILE_SAVE,
  51.         ID_SEPARATOR,
  52.     ID_EDIT_CUT,
  53.     ID_EDIT_COPY,
  54.     ID_EDIT_PASTE,
  55.         ID_SEPARATOR,
  56.     ID_FILE_PRINT,
  57.     ID_APP_ABOUT,
  58.     ID_CONTEXT_HELP,
  59. };
  60.  
  61. static UINT BASED_CODE indicators[] =
  62. {
  63.     ID_SEPARATOR,           // status line indicator
  64.     ID_INDICATOR_CAPS,
  65.     ID_INDICATOR_NUM,
  66.     ID_INDICATOR_SCRL,
  67. };
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CMainFrame construction/destruction
  71.  
  72. CMainFrame::CMainFrame()
  73. {
  74. }
  75.  
  76. CMainFrame::~CMainFrame()
  77. {
  78. }
  79.  
  80. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  81. {
  82.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  83.         return -1;
  84.  
  85.     if (!m_wndToolBar.Create(this) ||
  86.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  87.         !m_wndToolBar.SetButtons(buttons,
  88.           sizeof(buttons)/sizeof(UINT)))
  89.     {
  90.         TRACE0("Failed to create toolbar\n");
  91.         return -1;      // fail to create
  92.     }
  93.  
  94.     if (!m_wndStatusBar.Create(this) ||
  95.         !m_wndStatusBar.SetIndicators(indicators,
  96.           sizeof(indicators)/sizeof(UINT)))
  97.     {
  98.         TRACE0("Failed to create status bar\n");
  99.         return -1;      // fail to create
  100.     }
  101.  
  102.     EnableDocking(CBRS_ALIGN_ANY);
  103.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  104.     m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_SIZE_DYNAMIC);
  105.     DockControlBar(&m_wndToolBar);
  106.     return 0;
  107. }
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CMainFrame diagnostics
  111.  
  112. #ifdef _DEBUG
  113. void CMainFrame::AssertValid() const
  114. {
  115.     CMDIFrameWnd::AssertValid();
  116. }
  117.  
  118. void CMainFrame::Dump(CDumpContext& dc) const
  119. {
  120.     CMDIFrameWnd::Dump(dc);
  121. }
  122.  
  123. #endif //_DEBUG
  124.  
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CMainFrame commands
  127.